﻿@model GitCandy.Models.UserModel
@using GitCandy.Web.App_GlobalResources
@using NewLife.Model;
@using GitCandy.Web.Extensions;
@{
    ViewBag.Title = String.Format(SR.Shared_TitleFormat, String.Format(SR.Account_DetailTitle, Model.Name));
    var token = ViewBag.Token as IManageUser;
}
<h3>@String.Format(SR.Account_DetailTitle, Model.Name)</h3>

@if (Model != null)
{
    <dl class="dl-horizontal">

        <dt>@Html.DisplayNameFor(s => s.Name)</dt>
        <dd>@Model.Name</dd>

        <dt>@Html.DisplayNameFor(s => s.Nickname)</dt>
        <dd>@Model.Nickname</dd>

        <dt>@Html.DisplayNameFor(s => s.Email)</dt>
        <dd>@Model.Email</dd>

        <dt>@Html.DisplayNameFor(s => s.Repositories)</dt>
        <dd>@Html.DisplayFor(s => s.Repositories)</dd>

        <dt>@Html.DisplayNameFor(s => s.Teams)</dt>
        <dd>@Html.DisplayFor(s => s.Teams)</dd>

        <dt>@Html.DisplayNameFor(s => s.Description)</dt>
        <dd>@Model.Description</dd>

        @*@if (token != null && token.IsAdmin())
        {
            <dt>@Html.DisplayNameFor(s => s.IsAdmin)</dt>
            <dd>@Html.DisplayFor(s => s.IsAdmin)</dd>
        }*@

        @if (token != null && (token.Name == Model.Name || token.IsAdmin()))
        {
            <dt></dt>
            <dd>
                @Html.ActionLink(SR.Shared_Edit, "Edit", new { Model.Name }, new { @class = "btn btn-primary" })
                @Html.ActionLink(SR.Account_ChangePassword, "Change", new { Model.Name }, new { @class = "btn btn-info" })
            </dd>
        }
    </dl>
}
